<template>
  <section>
    <el-divider>字段设置</el-divider>
    <el-form-item label="字段类型" v-if="!value.forceFormat">
      <el-select v-model="value.format" placeholder="请选择" :style="{ width: '100%' }" clearable>
        <el-option label="文本" value="text" />
        <el-option label="数字" value="number" />
        <!-- <el-option label="年" value="year" />
        <el-option label="年月" value="yearmonth" />
        <el-option label="年月日" value="date" />
        <el-option label="日期和时间" value="email" /> -->
        <el-option label="邮箱" value="email" />
        <el-option label="手机号码" value="mobile" />
        <!-- <el-option label="QQ" value="qq" /> -->
        <el-option label="姓名" value="realname" />
        <el-option label="身份证" value="idcard" />
        <!-- <el-option label="网址" value="website" />-->
        <el-option label="正则表达式验证" value="regex" />
      </el-select>
    </el-form-item>

    <el-form-item label="输入框大小" v-if="value.format=='text'||value.format=='regex'">
      <el-select v-model="value.inputtype" placeholder="请选择" :style="{ width: '100%' }" clearable>
        <el-option label="单行" value="input" />
        <el-option label="多行" value="textarea" />
      </el-select>
    </el-form-item>
    <el-form-item label="默认值">
      <el-input v-model="value.defaultvalue" placeholder="" />
    </el-form-item>
    <el-form-item label="placeholder">
      <el-input v-model="value.placeholder" placeholder="" />
    </el-form-item>

    <el-form-item v-if="value.format=='text'" label="最小长度">
      <el-input-number v-model="value.format_text_minlength" :min="0" :max="10" label="描述文字"></el-input-number>
    </el-form-item>
    <el-form-item v-if="value.format=='text'" label="最大长度">
      <el-input-number v-model="value.format_text_maxlength" :min="1" :max="255" label="描述文字"></el-input-number>
    </el-form-item>
    <el-form-item v-if="value.format=='number'" label="是否整数">
      <el-switch v-model="value.format_number_isint" />
    </el-form-item>
    <el-form-item v-if="value.format=='number'" label="最小值">
      <el-input-number v-model="value.format_number_min" :min="0" :max="999999" label="描述文字"></el-input-number>
    </el-form-item>
    <el-form-item v-if="value.format=='number'" label="最大值">
      <el-input-number v-model="value.format_number_max" :min="0" :max="999999" label="描述文字"></el-input-number>
    </el-form-item>
    <el-form-item v-if="value.format=='regex'" label="正则">
      <el-input v-model="value.format_regex" placeholder="" />比如要求输入字符串:^[a-z]+$
    </el-form-item>
    <el-form-item v-if="value.format=='regex'" label="匹配错误提示">
      <el-input v-model="value.format_regex_errormsg" placeholder="" />不满足正则匹配的错误文字
    </el-form-item>
  </section>
</template>

<script>
  export default {
    props: {
      value: {
        type: Object,
        default: null
      },
    },
    data() {
      return {
        sp: {},
        sr: {},
        param: {}
      }
    },
    created(options) {
      let that = this;
      that.xinit();
    },
    methods: {
      xinit() {
        let that = this;
      },
    }
  }
</script>

<style>

</style>
